﻿using PetaPoco;
using PmSoft;
using PmSoft.Caching;
using System.ComponentModel;

namespace Modules.Cms.Entitys
{
    [TableName("cms_order")]
    [Description("订单管理（出库单）")]
    [PrimaryKey("id", AutoIncrement = false)]
    [CacheSetting(true,PropertyNamesOfArea = "DealerId")]
    [Serializable]
    public class CmsOrder:IDelEntity
    {

        /// <summary>
        /// 主键
        /// </summary>
        [Column("id")]
        public int Id { get; set; }

        /// <summary>
        /// 创建人ID
        /// </summary>
        [Column("create_user_id")]
        public int CreateUserId { get; set; }

        /// <summary>
        /// 创建人名称
        /// </summary>
        [Column("create_user_name")]
        public string CreateUserName { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Column("create_dt")]
        public DateTime CreateDt { get; set; }

        /// <summary>
        /// 更新人ID
        /// </summary>
        [Column("update_user_id")]
        public int UpdateUserId { get; set; }

        /// <summary>
        /// 更新人名称
        /// </summary>
        [Column("update_user_name")]
        public string UpdateUserName { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        [Column("update_dt")]
        public DateTime UpdateDt { get; set; }

        /// <summary>
        /// 删除标识
        /// </summary>
        [Column("is_deleted")]
        public bool IsDeleted { get; set; }
        /// <summary>
        /// 经销商id
        /// </summary>
        [Column("dealer_id")]
        public int DealerId { get; set; }

        /// <summary>
        /// 单据号
        /// </summary>
        [Column("bill_no")]
        public string BillNo { get; set; }

        /// <summary>
        /// 出库时间
        /// </summary>
        [Column("outbound_dt")]
        public DateTime? OutboundDt { get; set; }

        /// <summary>
        /// 出库数量
        /// </summary>
        [Column("outbound_qty")]
        public int? OutboundQty { get; set; }

        /// <summary>
        /// 收货人
        /// </summary>
        [Column("consignee")]
        public string Consignee { get; set; }

        /// <summary>
        /// 收获状态;10 未收货  20 已收货
        /// </summary>
        [Column("consignee_status")]
        public int? ConsigneeStatus { get; set; }

        /// <summary>
        /// 收货时间
        /// </summary>
        [Column("consignee_dt")]
        public DateTime? ConsigneeDt { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [Column("remark")]
        public string? Remark { get; set; }
        /// <summary>
        /// 类型 10 出库单  20 入库单
        /// </summary>
        [Column("type")]
        public int Type { get; set; }

        [Ignore]
        bool IDelEntity.IsDeletedInDatabase { get => IsDeleted; set => IsDeleted = value; }

        #region IEntity 成员

        [Ignore]
        object IEntity.EntityId { get { return this.Id; } }

        #endregion IEntity 成员
    }
}
